﻿/***************************************************************************
//* Foxit Software Inc.
//* Copyright(C) 2005-2012, all rights reserved.
//*
//* The following code is copyrighted and contains proprietary information
//* and trade secrets of Foxit Software Inc.                                                      *
***************************************************************************/

/**
* 简单的Point类
*/

define(function (require, exports, module) {
    var FXREADER = require('../FXReader.js');
    /**
     * Point class.
     * @class PPoint class.
     * @constructor
     * @param {Number} x x-axis value.
 	* @param {Number} y y-axis value.
     * @return a Point object.
     */
    FXREADER.CPDF_Point = function (x, y) {
        this.x = this.y = 0;
        if (arguments.length === 2) {
            this.x = isNaN(x) ? 0 : x;
            this.y = isNaN(y) ? 0 : y;
        }


        //public functions
        /**
         * @description Clone a new point object.
         * @return {FXREADER.CPDF_Point} the cloned point object.
         */
        this.Clone = function () {
            return (new this.constructor(this.x, this.y));
        };
        /**
         * @description Set value of the point.
         * @param {Number} x x-axis value.
 		* @param {Number} y y-axis value.
         */
        this.SetPoint = function (x, y) {
            if (isNaN(x) || isNaN(y)) return;
            this.x = x;
            this.y = y;
        };
        /**
         * @description Offset a point.
         * @param {Number} x x-axis value to offset.
 		* @param {Number} y y-axis value to offset.
         */
        this.Offset = function (x, y) {
            if (isNaN(x) || isNaN(y)) return;
            this.x += x;
            this.y += y;
        };
        /**
         * @description check whether the point is equal to another.
         * @param {FXREADER.CPDF_Point} JsPt another point object.
         */
        this.Equal = function (JsPt) {
            return (this.x == JsPt.x) && (this.y == JsPt.y);
        };

    };

    return FXREADER.CPDF_Point;
});